package na.learn.java.sorting;

public class TestComparator {

	/**
	 * @param args
	 */
	public static void main(String[] args) {

		Integer a = new Integer(5);
		Integer b = new Integer(5);

		if (a == 5)
			System.out.println("a==b");
		else
			System.out.println("a!=b");
		System.out.println("ABC, ABCD "
		 + new StringComparator().compare("ABC", "ABCD"));
		 System.out.println("ABCD, ABCD "
		 + new StringComparator().compare("ABCD", "ABCD"));
		 System.out.println("ABCD, ABC "
		 + new StringComparator().compare("ABCD", "ABC"));
		 System.out.println("ABCD, EFGH "
		 + new StringComparator().compare("ABCD", "EFGH"));

		 // Using Comparator
		 System.out.println("Sorting using Comparator");
		 System.out.println(System.currentTimeMillis());
		 Sortable[] sortables = { new SortableImpl("ABC"),
		 new SortableImpl("EFG"), new SortableImpl("AB"),
		 new SortableImpl("A"), new SortableImpl("Z"),
		 new SortableImpl("Y") };
		 SelectionSort.sort(sortables);
		 for (Sortable names : sortables)
		 System.out.println(names.getStringMessage());

		 // Using Comparable
		 System.out.println("Sorting using Comparable");
		 System.out.println(System.currentTimeMillis());
		 SortableImpl2[] sortables2 = { new SortableImpl2("ABC"),
		 new SortableImpl2("EFG"), new SortableImpl2("AB"),
		 new SortableImpl2("A"), new SortableImpl2("Z"),
		 new SortableImpl2("Y") };
		 SelectionSort.sort(sortables2);
		 for (SortableImpl2 names : sortables2)
		 System.out.println(names.getStringMessage());

		 System.out.println(System.currentTimeMillis());
		 
	}

}
